package com.xxxxxx.servlet;

import java.io.IOException;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

/*
 * 重定向
 * 服务端指导,客户端行为
 * 存在两次请求
 * 地址栏会发生改变
 * request对象不共享
 */

@WebServlet("/S4")
public class Servlet04 extends HttpServlet {

	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
			System.out.println("Servlet04....");
			
			//接受参数
			String uname = request.getParameter("uname");
			System.out.println("Servlet04 "+ uname); 
			
			//重定向跳转到S5
			response.sendRedirect("S5");
	}
		
}
